from ..Pos import Pos, PosSet
TOP = 2
LEFT = 1
RIGHT = 3
# 这里还没有 Transferer...
# 都是以 LEFT 为参考，重新写的相对方向函数


def d_up(x: Pos, dir: int):
    if dir == LEFT:
        return x.up()
    if dir == TOP:
        return x.x_right_down()
    if dir == RIGHT:
        return x.x_left_down()


def d_x_right_up(x: Pos, dir: int):
    if dir == LEFT:
        return x.x_right_up()
    if dir == TOP:
        return x.down()
    if dir == RIGHT:
        return x.x_left_up()


def d_forward(x: Pos, dir: int):
    return d_x_right_up(x, dir)


def d_x_right_down(x: Pos, dir: int):
    if dir == LEFT:
        return x.x_right_down()
    if dir == TOP:
        return x.x_left_down()
    if dir == RIGHT:
        return x.x_right_up()


def d_x_left_up(x: Pos, dir: int):
    if dir == LEFT:
        return x.x_left_up()
    if dir == TOP:
        return x.x_right_up()
    if dir == RIGHT:
        return x.down()


def d_down(x: Pos, dir: int):
    if dir == LEFT:
        return x.down()
    if dir == TOP:
        return x.x_left_up()
    if dir == RIGHT:
        return x.x_right_up()
